﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartPowerHub.Communication.Modbus
{
    /// <summary>
    /// Modbus返回数据
    /// </summary>
    public class ModbusResponse<T>
    {
        public ModbusResponse(bool state = true, FunctionCode? functionCode = null, string? message = null, byte[]? buffer = null)
        {
            State = state;
            Message = message;
            Buffer = buffer;
            FunctionCode = functionCode;
        }

        public bool State { get; set; }
        public FunctionCode? FunctionCode { get; set; }
        public string? Message { get; set; }
        public byte[]? Buffer { get; set; }
        /// <summary>
        /// 读取多个值
        /// </summary>
        public T[]? ValueArray { get; set; }
        /// <summary>
        /// 读取单个值
        /// </summary>
        public T? Value { get; set; }
    }
    public class ModbusResponse
    {
        public ModbusResponse(bool state = true, FunctionCode? functionCode = null, string? message = null)
        {
            State = state;
            Message = message;
            FunctionCode = functionCode;
        }

        public bool State { get; set; }
        public FunctionCode? FunctionCode { get; set; }
        public string? Message { get; set; }
    }
}
